﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;

namespace ICeFramework.Common.DataLayer.Interfaces
{
    public interface IDataAccessService
    {
        IDbConnection Connection { get; }

        string ParamToken { get; }
        bool Local { get; }

        void Fill(DataTable table, EntityFilter filter);
        void Fill(DataTable table, EntityFilter filter, IDbTransaction transaction);

        void Fill(DataTable table, EntityFilter filter, EntityOrder order);
        void Fill(DataTable table, EntityFilter filter, EntityOrder order, IDbTransaction transaction);

        void Fill(DataTable table, EntityFilter filter, int pageIndex, int pageSize, out long totalRowsCount);
        void Fill(DataTable table, EntityFilter filter, int pageIndex, int pageSize, out long totalRowsCount, IDbTransaction transaction);

        void Fill(DataTable table, EntityFilter filter, EntityOrder order, int pageIndex, int pageSize, out long totalRowsCount);
        void Fill(DataTable table, EntityFilter filter, EntityOrder order, int pageIndex, int pageSize, out long totalRowsCount, IDbTransaction transaction);

        void Fill(DataTable table, StoredProcedureDefinition spDefinition);
        void Fill(DataTable table, StoredProcedureDefinition spDefinition, IDbTransaction transaction);

        void Fill(DataTable table, StoredProcedureDefinition spDefinition, EntityOrder order);
        void Fill(DataTable table, StoredProcedureDefinition spDefinition, EntityOrder order, IDbTransaction transaction);

        int Count(DataTable table);
        int Count(DataTable table, EntityFilter filter);

        void Update(DataTable table, List<EntityColumn> columns);
        void Update(DataRow row, List<EntityColumn> columns);
        void Update(DataTable table, List<EntityColumn> columns, IDbTransaction transaction);
        void Update(DataRow row, List<EntityColumn> columns, IDbTransaction transaction);
    }
}
